Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make space in metadata optional for empty values #90

Merged
merged 1 commit into from
Oct 6, 2019

Conversation

Acconut
Copy link
Member

@Acconut Acconut commented Aug 28, 2016

The reasoning behind this change lays in tus/tus-js-client#41, to summarize:

If we have a metadata key-value pair with an empty value, we will get a value for the Upload-Metadata header such as: "empty_value ". Notice the space on the end of the string which normally separates the key and value. Usually, it should not be a problem that a header value ends with a space but in reality this is different, particularly in browsers.

For example, Chrome simply trims headers before sending a HTTP request to remove whitespace at the ends (https://cs.chromium.org/chromium/src/third_party/WebKit/Source/core/fetch/FetchUtils.cpp?sq=package:chromium&rcl=1471966011&l=209). On the other hand, Safari will refuse to add a header to a request which ends with a space (see request/request#1951 (comment)). Furthermore, such behavior is possibly not limited to browsers.

Basically, in both examples the clients are not able to send empty-valued metadata while being not compatible to the specification. Therefore, I suggest we make the separating space optional if the value is empty to circumvent these issues.

@kvz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant